
/**
 *
 * @author Xinchro
 */
public class Timer {

    int timeLeft;
    InputReader input;
    GUI gui;

    public static void main(String args[]) {
        Timer timer = new Timer();
    }

    public Timer() {
        timeLeft = 5;
        input = new InputReader(this);
        gui = new GUI(this);
        loop();
    }
    int timeDelay;
    boolean running = true;

    public void loop() {
        while (running) {
            timeDelay++;
            p(timeLeft);
            gui.setTime(timeLeft);
            try{
                Thread.sleep(1000);
            }catch(InterruptedException e){
                System.out.println(e);
            }
                countDown();
                timeDelay = 0;
        }
    }

    public void countDown() {
        if (timeLeft > 0) {
            timeLeft--;
        }
    }

    public int getTimeLeft() {
        return timeLeft;
    }

    public void p(String text) {
        System.out.println(text);
    }

    public void p(int text) {
        System.out.println(text);
    }
}
